/*
*	New C++ File starts here.
*	This file should be named skel.cc
*/

// Include all NML, CMS, and RCS classes and functions
#include "rcs.hh"

// Include command and status message definitions
#include "skel.hh"
#include "subIntf.hh"

// Forward Function Prototypes


#ifndef MAX_SUBINTF_NAME_LENGTH
#define MAX_SUBINTF_NAME_LENGTH 16
#endif
#ifndef SUBINTF_NAME_LIST_LENGTH
#define SUBINTF_NAME_LIST_LENGTH 12
#endif


/* This list must be in alphabetical order and the three lists must correspond. */
const char subIntf_name_list[SUBINTF_NAME_LIST_LENGTH][MAX_SUBINTF_NAME_LENGTH]= {
	"SubCfgCycleTime", /* 0,3302 */
	"SubCfgDebug", /* 1,3303 */
	"SubCfgNop", /* 2,3301 */
	"SubCmdAbort", /* 3,3103 */
	"SubCmdHalt", /* 4,3104 */
	"SubCmdInit", /* 5,3102 */
	"SubCmdNop", /* 6,3101 */
	"SubCmdShutdown", /* 7,3105 */
	"SubCmdTask", /* 8,3106 */
	"SubSet", /* 9,3401 */
	"SubStat", /* 10,3201 */
	""};
const NMLTYPE subIntf_id_list[SUBINTF_NAME_LIST_LENGTH]= {
	SUB_CFG_CYCLE_TIME_TYPE, /* 0,3302 */
	SUB_CFG_DEBUG_TYPE, /* 1,3303 */
	SUB_CFG_NOP_TYPE, /* 2,3301 */
	SUB_CMD_ABORT_TYPE, /* 3,3103 */
	SUB_CMD_HALT_TYPE, /* 4,3104 */
	SUB_CMD_INIT_TYPE, /* 5,3102 */
	SUB_CMD_NOP_TYPE, /* 6,3101 */
	SUB_CMD_SHUTDOWN_TYPE, /* 7,3105 */
	SUB_CMD_TASK_TYPE, /* 8,3106 */
	SUB_SET_TYPE, /* 9,3401 */
	SUB_STAT_TYPE, /* 10,3201 */
	-1};
const size_t subIntf_size_list[SUBINTF_NAME_LIST_LENGTH]= {
	sizeof(SubCfgCycleTime),
	sizeof(SubCfgDebug),
	sizeof(SubCfgNop),
	sizeof(SubCmdAbort),
	sizeof(SubCmdHalt),
	sizeof(SubCmdInit),
	sizeof(SubCmdNop),
	sizeof(SubCmdShutdown),
	sizeof(SubCmdTask),
	sizeof(SubSet),
	sizeof(SubStat),
	0};
const char *subIntf_symbol_lookup(long type);


// Enumerated Type Constants

// RCS_STATUS
#ifndef MAX_ENUM_RCS_STATUS_STRING_LENGTH
#define MAX_ENUM_RCS_STATUS_STRING_LENGTH 21
#endif
#ifndef ENUM_RCS_STATUS_LENGTH
#define ENUM_RCS_STATUS_LENGTH 5
#endif

static const char enum_RCS_STATUS_string_list[ENUM_RCS_STATUS_LENGTH][MAX_ENUM_RCS_STATUS_STRING_LENGTH]= {
	"RCS_DONE", /* 0,1 */
	"RCS_ERROR", /* 1,3 */
	"RCS_EXEC", /* 2,2 */
	"UNINITIALIZED_STATUS", /* 3,-1 */
	""};

static const int enum_RCS_STATUS_int_list[ENUM_RCS_STATUS_LENGTH]= {
	RCS_DONE, /* 0,1 */
	RCS_ERROR, /* 1,3 */
	RCS_EXEC, /* 2,2 */
	UNINITIALIZED_STATUS, /* 3,-1 */
	};

const char *subIntf_enum_RCS_STATUS_symbol_lookup(long v)
{
	switch(v)
	{
		case RCS_DONE: return("RCS_DONE"); /* 1 */
		case RCS_ERROR: return("RCS_ERROR"); /* 3 */
		case RCS_EXEC: return("RCS_EXEC"); /* 2 */
		case UNINITIALIZED_STATUS: return("UNINITIALIZED_STATUS"); /* -1 */
		default:break;
	}
	return(NULL);
}

static const struct cms_enum_info enum_RCS_STATUS_info_struct={
	"RCS_STATUS",
	(const char **)enum_RCS_STATUS_string_list,
	enum_RCS_STATUS_int_list,
	MAX_ENUM_RCS_STATUS_STRING_LENGTH,
	ENUM_RCS_STATUS_LENGTH,
	(cms_symbol_lookup_function_t)subIntf_enum_RCS_STATUS_symbol_lookup
	};

/*
Estimated_size	SubCfgCycleTime	32
Estimated_size	SubCfgDebug	32
Estimated_size	SubCfgNop	24
Estimated_size	SubCmdAbort	24
Estimated_size	SubCmdHalt	24
Estimated_size	SubCmdInit	24
Estimated_size	SubCmdNop	24
Estimated_size	SubCmdShutdown	24
Estimated_size	SubCmdTask	32
Estimated_size	SubSet	144
Estimated_size	SubStat	144
Estimated_size	MAXIMUM	144
*/
/*
*	NML/CMS Format function : subIntf_format
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
int subIntf_format(NMLTYPE type, void *buffer, CMS *cms)
{

	type = cms->check_type_info(type,buffer,"subIntf",
		(cms_symbol_lookup_function_t) subIntf_symbol_lookup,
		(const char **)subIntf_name_list,
		subIntf_id_list,subIntf_size_list,
		SUBINTF_NAME_LIST_LENGTH,
		MAX_SUBINTF_NAME_LENGTH);

	switch(type)
	{
	case SUB_CFG_CYCLE_TIME_TYPE:
		((SubCfgCycleTime *) buffer)->update(cms);
		break;
	case SUB_CFG_DEBUG_TYPE:
		((SubCfgDebug *) buffer)->update(cms);
		break;
	case SUB_CFG_NOP_TYPE:
		((SubCfgNop *) buffer)->update(cms);
		break;
	case SUB_CMD_ABORT_TYPE:
		((SubCmdAbort *) buffer)->update(cms);
		break;
	case SUB_CMD_HALT_TYPE:
		((SubCmdHalt *) buffer)->update(cms);
		break;
	case SUB_CMD_INIT_TYPE:
		((SubCmdInit *) buffer)->update(cms);
		break;
	case SUB_CMD_NOP_TYPE:
		((SubCmdNop *) buffer)->update(cms);
		break;
	case SUB_CMD_SHUTDOWN_TYPE:
		((SubCmdShutdown *) buffer)->update(cms);
		break;
	case SUB_CMD_TASK_TYPE:
		((SubCmdTask *) buffer)->update(cms);
		break;
	case SUB_SET_TYPE:
		((SubSet *) buffer)->update(cms);
		break;
	case SUB_STAT_TYPE:
		((SubStat *) buffer)->update(cms);
		break;

	default:
		return(0);
	}
	return 1;
}


// NML Symbol Lookup Function
const char *subIntf_symbol_lookup(long type)
{
	switch(type)
	{
	case SUB_CFG_CYCLE_TIME_TYPE:
		return "SubCfgCycleTime";
	case SUB_CFG_DEBUG_TYPE:
		return "SubCfgDebug";
	case SUB_CFG_NOP_TYPE:
		return "SubCfgNop";
	case SUB_CMD_ABORT_TYPE:
		return "SubCmdAbort";
	case SUB_CMD_HALT_TYPE:
		return "SubCmdHalt";
	case SUB_CMD_INIT_TYPE:
		return "SubCmdInit";
	case SUB_CMD_NOP_TYPE:
		return "SubCmdNop";
	case SUB_CMD_SHUTDOWN_TYPE:
		return "SubCmdShutdown";
	case SUB_CMD_TASK_TYPE:
		return "SubCmdTask";
	case SUB_SET_TYPE:
		return "SubSet";
	case SUB_STAT_TYPE:
		return "SubStat";
	default:
		return"UNKNOWN";
		break;
	}
	return(NULL);
}

/*
*	NML/CMS Update function for SubCmdNop
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCmdNop::update(CMS *cms)
{

	cms->beginClass("SubCmdNop","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);

	cms->endClass("SubCmdNop","RCS_CMD_MSG");

}


/*
*	NML/CMS Update function for SubCfgCycleTime
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCfgCycleTime::update(CMS *cms)
{

	cms->beginClass("SubCfgCycleTime","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);
	cms->update_with_name("cycleTime",cycleTime);

	cms->endClass("SubCfgCycleTime","RCS_CMD_MSG");

}


/*
*	NML/CMS Update function for SubCmdShutdown
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCmdShutdown::update(CMS *cms)
{

	cms->beginClass("SubCmdShutdown","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);

	cms->endClass("SubCmdShutdown","RCS_CMD_MSG");

}


/*
*	NML/CMS Update function for SubCfgNop
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCfgNop::update(CMS *cms)
{

	cms->beginClass("SubCfgNop","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);

	cms->endClass("SubCfgNop","RCS_CMD_MSG");

}


/*
*	NML/CMS Update function for SubCfgDebug
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCfgDebug::update(CMS *cms)
{

	cms->beginClass("SubCfgDebug","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);
	cms->update_with_name("debug",debug);

	cms->endClass("SubCfgDebug","RCS_CMD_MSG");

}


/*
*	NML/CMS Update function for SubStat
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubStat::update(CMS *cms)
{

	cms->beginClass("SubStat","RCS_STAT_MSG");

	RCS_STAT_MSG::update_stat_msg_base(cms);
	cms->update_with_name("heartbeat",heartbeat);
	cms->update_with_name("what",what);

	cms->endClass("SubStat","RCS_STAT_MSG");

}


/*
*	NML/CMS Update function for SubCmdHalt
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCmdHalt::update(CMS *cms)
{

	cms->beginClass("SubCmdHalt","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);

	cms->endClass("SubCmdHalt","RCS_CMD_MSG");

}


/*
*	NML/CMS Update function for SubSet
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubSet::update(CMS *cms)
{

	cms->beginClass("SubSet","RCS_STAT_MSG");

	RCS_STAT_MSG::update_stat_msg_base(cms);
	cms->update_with_name("cycleTime",cycleTime);
	cms->update_with_name("debug",debug);

	cms->endClass("SubSet","RCS_STAT_MSG");

}


/*
*	NML/CMS Update function for SubCmdAbort
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCmdAbort::update(CMS *cms)
{

	cms->beginClass("SubCmdAbort","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);

	cms->endClass("SubCmdAbort","RCS_CMD_MSG");

}


/*
*	NML/CMS Update function for SubCmdInit
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCmdInit::update(CMS *cms)
{

	cms->beginClass("SubCmdInit","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);

	cms->endClass("SubCmdInit","RCS_CMD_MSG");

}


/*
*	NML/CMS Update function for SubCmdTask
*	Automatically generated by NML CodeGen Java Applet.
*	on Thu Mar 09 10:55:36 EST 2006
*/
void SubCmdTask::update(CMS *cms)
{

	cms->beginClass("SubCmdTask","RCS_CMD_MSG");
	RCS_CMD_MSG::update_cmd_msg_base(cms);
	cms->update_with_name("what",what);

	cms->endClass("SubCmdTask","RCS_CMD_MSG");

}

